/**
 * http://usejsdoc.org/
 * 关于数据库建表的配置信息处理
 * 
 */

let path = require('path');
let fs = require('fs');
let path1=path.resolve(__dirname,"table");
var files=fs.readdirSync(path1,"utf8");
//定义类
class TableDataHandler {
  constructor(x, y) {
    this.x = x;
    this.y = y;
  }
  handlerPromise(promise){
	 return  promise.then(function(data){
		 var arg=data;
		  files.forEach(function(item){
			  var temp= require("./table/"+item).handler(arg);
			  arg=temp?temp:arg;
		  });
		  return arg;
	  });
  }
  
}
let handler1=new TableDataHandler();
module.exports={
	handler:handler1.handlerPromise
}